﻿<Window x:Class="WpfImageDuplicates.Window1"
        xmlns:cal="http://www.codeplex.com/CompositeWPF"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        
        Activated="Window_Activated"                
        Closed="Window1_Closed"
        xmlns:y="clr-namespace:WpfImageDuplicates"  Closing="Window_Closing" Loaded="Window1_Loaded"
        Title="WPF Image Application" Width="800" Height="600">
    <Window.CommandBindings>
        <CommandBinding Command="{x:Static y:Commands.RemoveDuplicatesCommand}" Executed="RemoveDuplicates"/>
        <CommandBinding Command="{x:Static y:Commands.WantCompareMultipleCommand}" Executed="WantCompareMultiple"/>
        <CommandBinding Command="{x:Static y:Commands.WantCompareMultipleInNewWindow}" Executed="WantCompareMultipleInNewWindow"/>
        <CommandBinding Command="{x:Static y:Commands.ViewStatsCommand}" Executed="ViewStats" />
        <CommandBinding Command="{x:Static y:Commands.ViewSettingsCommand}" Executed="ViewSettings"/>
        <CommandBinding Command="{x:Static y:Commands.SaveSettingsCommand}" Executed="SaveSettings"/>
        <CommandBinding Command="{x:Static y:Commands.WantBlurCommand}" Executed="WantBlur"/>
        <CommandBinding Command="{x:Static y:Commands.Extra1Command}" Executed="Extra1CommandExecuted"/>
        <CommandBinding Command="{x:Static y:Commands.WantViewFullCommand}" Executed="WantViewFullCommandExecuted"/>
        <CommandBinding Command="{x:Static y:Commands.WantRefreshThumbsCommand}" Executed="WantRefreshThumbs"/>
        <CommandBinding Command="{x:Static y:Commands.ViewFolderExplorerCommand}" Executed="ViewFolderExplorer"/>
        <CommandBinding Command="{x:Static y:Commands.ShowMultipleImagesCommand}" Executed="ShowMultipleImagesCommandExecute"/>
    </Window.CommandBindings>
    <Window.InputBindings>
        <KeyBinding Command="{x:Static y:Commands.ViewStatsCommand}" Key="T" Modifiers="Control"/>
        <KeyBinding Command="{x:Static y:Commands.ViewSettingsCommand}" Key="S" Modifiers="Control"/>
        <KeyBinding Command="{x:Static y:Commands.ViewFolderExplorerCommand}" Key="F" Modifiers="Control"/>
    </Window.InputBindings>
    <DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SnapsToDevicePixels="True"  
               LastChildFill="True" x:Name="dockPanel">
        <Menu DockPanel.Dock="Top" Height="22" Margin="4,0,0,0" x:Name="mainMenu" HorizontalAlignment="Stretch" VerticalAlignment="Top" Width="Auto">
            <MenuItem Header="_File">
                <MenuItem x:Name="mnuSaveGroups" Header="Save _Groups" Click="mnuSaveGroups_Click"/>
                <MenuItem x:Name="mnuSaveFilters" Header="Save _Filters" Click="mnuSaveFilters_Click"/>
                <MenuItem x:Name="mnuSaveSettings" Header="Save _Settings" Click="mnuSaveSettings_Click"/>
                <MenuItem x:Name="mnuDeleteSettings" Header="_Delete All Settings and Filters" Click="mnuDeleteSettings_Click"/>
                <MenuItem x:Name="mnuExit" Header="E_xit" Click="mnuExit_Click"/>
            </MenuItem>
            <MenuItem Header="_View">
                <MenuItem x:Name="viewSettings" Command="{x:Static y:Commands.ViewSettingsCommand}" Header="S_ettings/Configuration" />
                <MenuItem x:Name="viewStats" Command="{x:Static y:Commands.ViewStatsCommand}" Header="View Runtime _Stats" />
                <Separator></Separator>
                <MenuItem x:Name="mnuFilters" Header="_Filters" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ShowFilters}" />
                <MenuItem x:Name="mnuDirectories" Header="_Directories" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=DirectoriesVisible}" />
                <MenuItem x:Name="mnuThumbnails" Header="_Thumbnails" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ThumbnailsVisible}" />
                <MenuItem x:Name="mnuFolderExplorer" Header="Folder E_xplorer" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=FolderExplorerVisible}" />
                <MenuItem x:Name="mnuFilterExplorer" Header="Fi_lter Explorer" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=FilterExplorerVisible}" />
                <MenuItem x:Name="mnuFullViewer" Header="Full Image _Viewer" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=FullViewerVisible}" />
                <MenuItem x:Name="mnuFolderListVisible" Header="Fo_lders Organizer" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=FolderListVisible}" />
                <MenuItem x:Name="mnuFolderOrganizerVisible" Header="Group _Organizer" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=GroupOrganizerVisible}" />
                <Separator />
            </MenuItem>
            <MenuItem Header="_Tools">
                <MenuItem x:Name="removeDupes" Command="{x:Static y:Commands.RemoveDuplicatesCommand}" Header="_Remove Duplicated Images" />
                <MenuItem x:Name="calcBlur" Command="{x:Static y:Commands.WantBlurCommand}" Header="_Calculate Blurs" />
                <Separator></Separator>

                <MenuItem x:Name="mnuDeleteThumbnailCache" Header="_Delete Thumbnail Cache" Click="mnuDeleteThumbnailCache_Click"/>
            </MenuItem>
            <MenuItem Header="_Commands">
                <MenuItem x:Name="filterSteps" Command="{x:Static y:Commands.ShowMultipleImagesCommand}" Header="_Display Filter Steps" />
                <MenuItem x:Name="compareMultiple" Command="{x:Static y:Commands.WantCompareMultipleCommand}" Header="Compare _Multiple Images" />
                <MenuItem x:Name="refreshThumbs" Command="{x:Static y:Commands.WantRefreshThumbsCommand}" Header="Refresh _Thumbnails" />
            </MenuItem>
            <MenuItem Header="_Settings" x:Name="settingsMenuItem">
                <MenuItem Header="Show _Command Bar" x:Name="viewCommandBar" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ShowCommandBar}"/>
                <MenuItem Header="_Show Filters" x:Name="ShowFilters" IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ShowFilters}"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=HighQualityThumbs}" Header="High Quality _Thumbnails"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=EvenThumbWidths}" Header="Even Thumbnail _Widths"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ThumbShowFileName}" Header="Show Thumbnail File _Names"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ThumbShowFileSize}" Header="Show Thumbnail File _Size"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ThumbShowDimensions}" Header="Show Thumbnail File D_imensions"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ThumbShowFileDate}" Header="Show Thumbnail File _Date"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ShowThumbCommandBar}" Header="Show Thumbnail _Command Bar"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ViewerIsTopmost}" Header="Viewe_r is Topmost"/>
                <MenuItem IsCheckable="True" IsChecked="{Binding Mode=TwoWay, Path=ThumbnailDebugMode}" Header="Thumbnail _Debug Mode"/>                
                <MenuItem Header="Sm_oothing Mode">
                    <ComboBox FontSize="10" Margin="0,0,2,0" HorizontalAlignment="Stretch" ItemsSource="{Binding AllSmoothingModes}" SelectedValue="{Binding Mode=TwoWay, Path=SmoothingMode}" />
                </MenuItem>
                <MenuItem Header="Standard Pi_xel Format">
                    <ComboBox Grid.Column="3" FontSize="10" HorizontalAlignment="Stretch" Margin="0,0,2,0" ItemsSource="{Binding AllStandardColorPixelFormats}" SelectedValue="{Binding Mode=TwoWay, Path=StandardColorPixelFormat}" />
                </MenuItem>
                <MenuItem Header="_Calculate Memory usage" x:Name="mnuTest" Click="mnuTest_Click"/>
            </MenuItem>
            <Separator></Separator>
            <MenuItem x:Name="statusMenuItem"/>
        </Menu>
        <y:TopCommandBar DockPanel.Dock="Top" x:Name="topCommandBar" Width="Auto" HorizontalAlignment="Stretch" Height="18"                         
                         ChangeThumbnailSize="ChangeThumbnailSize" />
        <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch" x:Name="mainGrid" PreviewMouseLeftButtonDown="mainGrid_PreviewMouseLeftButtonDown">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition MinWidth="3" Width="Auto"/>                
            </Grid.ColumnDefinitions>
            <Grid Grid.Row="0" Margin="0,0,0,4">
                <Grid x:Name="mainImageCollectionViewGrid" VerticalAlignment="Stretch">
                </Grid>
            </Grid>
            <Grid Grid.Column="1" Margin="3,0,0,0" x:Name="rightContainer">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MinWidth="20" Width="Auto"/>
                    <ColumnDefinition MinWidth="20" Width="Auto"/>
                    <ColumnDefinition Width="Auto" MinWidth="3"/>
                </Grid.ColumnDefinitions>
                <Grid Grid.Column="0" Margin="3,0,3,0" x:Name="groupsViewControlContainer" SizeChanged="groupsViewControlContainer_SizeChanged">
                    <y:GroupsViewControl x:Name="groupsViewControl" HorizontalAlignment="Stretch" />
                </Grid>
                <GridSplitter Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Stretch" Width="3" Foreground="Green" Background="Green" BorderBrush="Green"
                              x:Name="splitterBetweenGroupsAndDirectories"/>
                <Grid Grid.Column="1" Margin="0,0,0,0" x:Name="directoriesViewControlContainer" SizeChanged="directoriesViewControlContainer_SizeChanged" HorizontalAlignment="Stretch">
                    <y:DirectoryCollectionsViewControl x:Name="directoryCollections" HorizontalAlignment="Stretch" />
                </Grid>
                <GridSplitter Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="3" Foreground="Green" Background="Green" BorderBrush="Green"
                              x:Name="rightSplitter"/>
            </Grid>            
            <GridSplitter Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="3" Foreground="Green" Background="Green" BorderBrush="Green"/>
            <GridSplitter Grid.Row="0" x:Name="splitter1" Foreground="Blue" Height="4" DragStarted="splitter1_DragStarted"                           
                          VerticalAlignment="Bottom" Background="Blue" HorizontalAlignment="Stretch" Width="Auto"
                          DragCompleted="splitter1_DragCompleted"/>
            <Grid Grid.Row="1" Margin="0,4,0,0">
                <Grid x:Name="filterGrid">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="20"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Grid Grid.Row="0" Background="LightGoldenrodYellow">
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Left" Text="Filters"/>
                        <TextBlock HorizontalAlignment="Right" x:Name="btnClose" VerticalAlignment="Center" Text="X" Foreground="Black"
                       Cursor="Hand" MouseLeftButtonDown="btnClose_MouseLeftButtonDown"/>
                    </Grid>
                    <Border Grid.Row="1" BorderThickness="2" BorderBrush="Green">
                        <y:FilterViewWindow Grid.Row="1" x:Name="filterView" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                    </Border>
                </Grid>
            </Grid>
        </Grid>
    </DockPanel>
</Window>
